<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台登录-<?php echo siteInfo('sitename');?></title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="<?php echo U_RES_APP;?>/css/login.css">
    <!--[if lt IE 9]>
          <script src="<?php echo U_RES;?>/lib/js/html5shiv-printshiv.min.js"></script>
          <script src="<?php echo U_RES;?>/lib/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>
    <div class="login layui-anim layui-anim-up">
        <div class="message"><?php echo siteInfo('sitename');?></div>
        <div id="darkbannerwrap"></div>
		<div id="dvhide">
        <form method="post" class="layui-form">
            <input name="username" placeholder="用户名" type="text" lay-verify="required" class="layui-input"
                value="">
            <hr class="hr15">
            <input name="password" lay-verify="required" placeholder="密码" type="password" class="layui-input"
                value="">
            <hr class="hr15">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
            <hr class="hr20">
        </form>
		</div>
		<div id="dvshow" style="display:none; font-size:14px;color:red;">
		<h2>系统检测到您的浏览器不支持进入本系统后台</h2>
		本系统支持IE11以上及chrome、edge、火狐等核心浏览器！
		<br>
		<br>win7 及以上64位系统推荐下载安装（<a href="">chrome 71浏览器</a>）
			或（<a href="">chrome 76浏览器</a>）
		<br>
		<br>
		winXP以下或32位系统推荐下载安装（<a href="">chrome 48浏览器</a>）或者（<a href="">chrome 45浏览器</a>）
		</div>
		
    </div>
    <!-- <script src="/res/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script> -->
	<script src="<?php echo U_RES;?>/lib/jquery-1.11.3.min.js"></script>
    <script src="<?php echo U_RES;?>/lib/layui/layui.js" charset="utf-8"></script>
    <script>
			$("#dvshow").hide();
			$("#dvhide").hide();
			var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
			var isChrome = userAgent.indexOf("Chrome") > -1;//判断是否CHROME
			var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 
			 function IEVersion() {
					var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串  
					var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器  
					var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 
					var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
					if(isIE) {
						var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
						reIE.test(userAgent);
						var fIEVersion = parseFloat(RegExp["$1"]);
						if(fIEVersion == 7) {
							return 7;
						} else if(fIEVersion == 8) {
							return 8;
						} else if(fIEVersion == 9) {
							return 9;
						} else if(fIEVersion == 10) {
							return 10;
						} else {
							return 6;//IE版本<=7
						}	
					} else if(isEdge) {
						return 'edge';//edge
					} else if(isIE11) {
						return 11; //IE11  
					}else{
						return -1;//不是ie浏览器
					}
				}
			//if (isChrome || IEVersion()>=9 || isEdge){
			if (isChrome || IEVersion()>=11 || isEdge){
				$("#dvhide").show();
			} else {
				$("#dvshow").show();
			};
			
			
        layui.use(['form', 'jquery'], function () {
            var form = layui.form,
                layer = layui.layer,
                $ = layui.jquery;

            // 进行登录操作
            form.on('submit(login)', function (data) {
                data = data.field;
                if (data.username == '') {
                    layer.msg('用户名不能为空');
                    return false;
                }
                if (data.password == '') {
                    layer.msg('密码不能为空');
                    return false;
                }

                loading = layer.load(1, { shade: [0.1, '#fff'] });//0.1透明度的白色背景{username:data.username,password:data.password}
                $.post('<{caUrl("login","login")}>', data, function (res) {
                    layer.close(loading);
                    if (res.status == 1) {
                        layer.msg(res.info, { icon: 1, time: 1000 }, function () {
                            location.href = '/admin';
                        });
                    } else {
                        $('#captcha').val('');
                        layer.msg(res.info, { icon: 2, anim: 6, time: 5000 });
                        $('.captcha img').attr('src', '<{caUrl("login","verify")}>' + Math.random());
                    }
                });
                return false;
            });
        });
    </script>

</body>

</html>